<?php
include_once '../Config/config.php';
include_once '../Config/conexion.php';

//Paper
include_once '../Model/Paper.php';

$idpaper = $_POST["idpaper"];
$paper = Paper::Obtener($idpaper);
$paper->ObtenerAutores();
$lista = $paper->Autores;
?>

<?php
	if(count($lista) == 0){
?>	
	<div class="grid_11 alpha omega">
		<input type="button" value="" class="agregar-autor" 
			data-idpaper="<?php echo $idpaper?>">
	</div>
<?php	
		exit();
	}
?>

<div class="grid_22 alpha omega">
		<h2>
			Autores del paper
		</h2>
		
<table class="tabla-basica">
	<thead>
		<tr>
			<th><strong>Nombre Completo</strong></th>
			<th><strong>Email</strong></th>
			<th><strong>Pais</strong></th>
			<th></th>
		</tr>
	</thead>
	
	<tbody>			
	<?php
	foreach($lista as $autor)
		{
	?>
	
		<tr>
			<td>
				<?php echo $autor->Paterno;?> <?php echo $autor->Materno;?>, <?php echo $autor->Nombres;?>
			</td>
			<td>
				<?php echo $autor->Email?>
			</td>
			<td>
				<?php echo $autor->Pais->Nombre?>
			</td>
			<td>
				<!--<span class="eliminar-autor"
				data-idautor="<?php echo $autor->IdUsuario?>"
				data-idpaper="<?php echo $idpaper?>">
					Eliminar
				</span>-->
				<img src="<?php echo INI_URL?>/Content/Template01/images/trash.png" class="eliminar-autor"
				data-idautor="<?php echo $autor->IdUsuario?>"
				data-idpaper="<?php echo $idpaper?>"
				title="Eliminar Autor"
				style = "cursor:pointer"
				/>
			</td>
		</tr>	
	
	  <?php
		}
	 ?>
	</tbody>
</table>
</div>
	<div class="grid_22 alpha omega" >
		<input type="button" value="" class="agregar-autor" 
			data-idpaper="<?php echo $idpaper?>" />
			
		<input type="button" value="" class="finalizar" 
			data-idpaper="<?php echo $idpaper?>" />			
	</div>
